package com.bdqn.mr.mj;

import org.apache.hadoop.io.Writable;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

public class TableBean implements Writable {
    public TableBean() {

    }

    // 1001	01	1
    private String orderId;     // 订单编号
    private String pid;         // 产品ID
    private Integer amount;     // 产品数量

    // 01	小米
    // 02	华为
    // 03	格力
    private String pName;       // 产品名称



    @Override
    public void write(DataOutput out) throws IOException {
        //
        out.writeUTF(orderId);
        out.writeUTF(pid);
        out.writeInt(amount);
        out.writeUTF(pName);

    }

    @Override
    public void readFields(DataInput in) throws IOException {
        //
        this.orderId = in.readUTF();
        this.pid = in.readUTF();
        this.amount = in.readInt();
        this.pName = in.readUTF();
    }

    @Override
    public String toString() {
        return orderId + '\t' + pName + "\t" + amount;
    }

    public String getOrderId() {
        return orderId;
    }

    public void setOrderId(String orderId) {
        this.orderId = orderId;
    }

    public String getPid() {
        return pid;
    }

    public void setPid(String pid) {
        this.pid = pid;
    }

    public Integer getAmount() {
        return amount;
    }

    public void setAmount(Integer amount) {
        this.amount = amount;
    }

    public String getpName() {
        return pName;
    }

    public void setpName(String pName) {
        this.pName = pName;
    }

}
